import MyContext from './context.js'
import { useContext } from 'react'
export default function IncrementButton() {
  const context = useContext(MyContext)
  console.log(context); //{ state, dispatch }
  return (
    <div>
      <h1>Button组件： count: {context.state.count} </h1>
      <button onClick={() => context.dispatch({ type: 'increment' })}>+</button>
      <button onClick={() => context.dispatch({ type: 'decrement' })}>-</button>
    </div>
  )
}